package qc.module.ehs.mapper;

import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;
import qc.module.ehs.dto.checkrecord.CheckRecordDto;
import qc.module.ehs.dto.checkrecord.CheckRecordSaveDto;
import qc.module.ehs.entity.EhsCheckRecord;

/**
 * EhsCheckRecordMapper
 *
 * @author QuCheng Tech
 * @create 2024/10/24
 */
@Mapper
public interface EhsCheckRecordMapper {
    EhsCheckRecordMapper MAPPER = Mappers.getMapper(EhsCheckRecordMapper.class);

    /**
     * entity -> dto
     * @param en
     * @return
     */
    @Mapping(target = "intm", source = "intm", dateFormat = "yyyy-MM-dd HH:mm:ss")
    @Mapping(target = "updatetm", source = "updatetm", dateFormat = "yyyy-MM-dd HH:mm:ss")
    CheckRecordDto toDto(EhsCheckRecord en);

    /**
     * dto -> entity
     * @param dto
     * @return
     */
    @Mapping(target = "intm", source = "intm", dateFormat = "yyyy-MM-dd HH:mm:ss")
    @Mapping(target = "updatetm", source = "updatetm", dateFormat = "yyyy-MM-dd HH:mm:ss")
    EhsCheckRecord toEntity(CheckRecordDto dto);

    /**
     * saveDto -> entity
     * @param saveDto
     * @return
     */
    @Mapping(target = "intm", source = "intm", dateFormat = "yyyy-MM-dd HH:mm:ss")
    @Mapping(target = "updatetm", source = "updatetm", dateFormat = "yyyy-MM-dd HH:mm:ss")
    EhsCheckRecord saveDtoToEntity(CheckRecordSaveDto saveDto);
}
